﻿/*-------------------------------------------------------------------------
* 命名空间: WaferSelectV3.ValueConverters/UserPasswordConverter
* 类       名: UserPasswordConverter
* 功      能:  TD
* 时      间:  2024-05-24 14:09:21
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using WaferSelectV3.Common;
using WaferSelectV3.Models;

namespace WaferSelectV3.ValueConverters
{
    public class UserPasswordConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is string password)
            {
                if (GlobalValues.CurrentLoginUser.Role == (int)RoleType.操作员)
                {
                    return new string('*', password.Length);
                }
            }
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Binding.DoNothing;
        }
    }
}
